home *** CD-ROM | disk | FTP | other *** search
/ Aminet 30 / Aminet 30 (1999)(Schatztruhe)[!][Apr 1999].iso / Aminet / dev / lang / SmallEiffel.lha / SmallEiffel / lib_se / infix_name.e < prev    next >
Text File  |  1998-12-22  |  2KB  |  96 lines

  1. --          This file is part of SmallEiffel The GNU Eiffel Compiler.
  2. --          Copyright (C) 1994-98 LORIA - UHP - CRIN - INRIA - FRANCE
  3. --            Dominique COLNET and Suzanne COLLIN - colnet@loria.fr 
  4. --                       http://www.loria.fr/SmallEiffel
  5. -- SmallEiffel is  free  software;  you can  redistribute it and/or modify it 
  6. -- under the terms of the GNU General Public License as published by the Free
  7. -- Software  Foundation;  either  version  2, or (at your option)  any  later 
  8. -- version. SmallEiffel is distributed in the hope that it will be useful,but
  9. -- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
  10. -- or  FITNESS FOR A PARTICULAR PURPOSE.   See the GNU General Public License 
  11. -- for  more  details.  You  should  have  received a copy of the GNU General 
  12. -- Public  License  along  with  SmallEiffel;  see the file COPYING.  If not,
  13. -- write to the  Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. -- Boston, MA 02111-1307, USA.
  15. --
  16. class INFIX_NAME
  17.    --   
  18.    -- To store an infix name of operator.
  19.    --
  20.  
  21. inherit FEATURE_NAME;
  22.    
  23. creation make
  24.    
  25. feature    
  26.  
  27.    to_string: STRING;
  28.  
  29.    start_position: POSITION;
  30.    
  31.    to_key: STRING;
  32.  
  33. feature
  34.  
  35.    is_frozen: BOOLEAN is false;
  36.  
  37. feature {NONE}
  38.  
  39.    make(n: STRING; sp: like start_position) is
  40.       require
  41.      n.count >= 1;
  42.      sp /= Void
  43.       do
  44.      to_string := unique_string.item(n);
  45.      start_position := sp;
  46.      to_key := unique_string.for_infix(to_string);
  47.       ensure
  48.      to_string = unique_string.item(n);
  49.      start_position = sp;
  50.      to_key = unique_string.item(to_key)
  51.       end;
  52.  
  53. feature 
  54.  
  55.    declaration_in(str: STRING) is
  56.       do
  57.      str.append(fz_infix);
  58.      str.extend(' ');
  59.      str.extend('%"');
  60.      str.append(to_string);
  61.      str.extend('%"');
  62.       end;
  63.  
  64.    pretty_print is
  65.       do
  66.      fmt.put_string(to_string);
  67.       end;
  68.  
  69.    declaration_pretty_print is
  70.       do
  71.      fmt.keyword(fz_infix);
  72.      fmt.put_character('%"');
  73.      fmt.put_string(to_string);
  74.      fmt.put_character('%"');
  75.       end;
  76.  
  77. feature
  78.  
  79.    short is
  80.       do
  81.      short_print.a_infix_name("Bifn","infix %"",
  82.                   "Aifn","%"",
  83.                   Current);
  84.       end;
  85.  
  86. feature {RUN_FEATURE,FEATURE_NAME}
  87.  
  88.    put_cpp_tag is
  89.       do
  90.      cpp.put_string(fz_infix);
  91.      cpp.put_character(' ');
  92.       end;
  93.  
  94. end -- INFIX_NAME
  95.  
  96.